export default {
    namespaced: true,
    state: {
        urls: [],
        pages:[],
        activeIndex: 0,
    },
    mutations: {
        setUrls(state,data) {
            for(let i in data){
                if(data[i].name == '听书') {
                    data.splice(i,1);
                    break;
                }
            }
            state.urls = data;
            // console.log('state.urls',state.urls);
        },
        setPage(state,dataANum) {
            state.pages[dataANum.num] = dataANum.data;
        },
        clearPages(state) {
            state.pages = [];
        },
        setActiveIndex(state,i) {
            state.activeIndex = i;
        },
        setPage(state,data){
            state.pages[data.i] = data.d;
        }
    },
    actions: {
        setUrlAsync(content, data) {
            content.commit('setUrls',data);
        },
        setPageAsync(content,data) {
            content.commit('setPage',data);
        }
    }
}